Skip to content

build: Cache during Docker build for speed#29

Merged
Peeja merged 1 commit intomainfrom
build/cache-docker-build
Apr 21, 2026
Merged

build: Cache during Docker build for speed#29
Peeja merged 1 commit intomainfrom
build/cache-docker-build

Conversation

@Peeja
Copy link
Copy Markdown
Member

@Peeja Peeja commented Apr 20, 2026

No description provided.

Comment thread Dockerfile
FROM build AS build-prod
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what's going on here? Is this caching twice? Why is that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's caching two directories: the dependency cache and the build cache. This means it doesn't have to re-download modules every build, and it…builds faster? I'm not sure how the build cache works, but apparently it can cache bits of the build.

@Peeja Peeja merged commit 899c465 into main Apr 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants